<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>    
    <div id="app">       
        <!-- <book v-bind:model-value="msg" @update:model-value="fn"></book> -->
        <book v-model="msg"></book>
    </div>

    <script src="./js/vue.global.js"></script>

    <script>

        let book = {
            props:['modelValue'],
            emits:['update:modelValue'],
            template:`
            <div>书籍组件</div>
            <div>modelValue:{{modelValue}}</div>
            <input type="button" value="修改" @click="change"/>
            `,
            methods:{
                change(){
                    this.$emit("update:modelValue","新值");
                }
            }
        }

       
        let app = Vue.createApp({
            data(){
                return {
                    msg:"hello"
                }
            },
            methods:{
                fn(str){
                    // console.log("hello");
                    this.msg = str;
                }
            }            
        });

        app.component("book",book);
      
        app.mount("#app");

    </script>
</body>
</html>